home *** CD-ROM | disk | FTP | other *** search
GW-BASIC | 1997-01-28 | 10.6 KB | 377 lines |
- 10 'COILDSGN - Coil Design - 22 NOV 94 rev. 05 JAN 97
- 20 CLS:KEY OFF
- 30 IF EX$=""THEN EX$="EXIT"
- 40 IF PROG$=""THEN GO$=EX$ ELSE GO$=PROG$
- 50 COMMON EX$,PROG$,LX
- 60 IF UH THEN UH=INT(UH*10^3+0.5)/10^3
- 70 COLOR 7,0,1
- 80 DIM GA(40) 'AWG gauge
- 90 DIM G#(9,2) 'shotgun gauges
- 100 DIM P$(11,2) 'pipe sizes
- 110 UL$=STRING$(80,205)
- 120 U1$="####.###"
- 130 U2$="####.#"
- 140 PI=3.14159
- 150 '
- 160 '.....AWG calculator
- 170 K=(0.46/0.005)^(1/39) 'increment multiplier
- 180 FOR Z=1 TO 40
- 190 N=Z+3
- 200 GA(Z)=0.46/K^N
- 210 NEXT Z
- 220 '
- 230 '.....start
- 240 CLS
- 250 COLOR 15,2
- 260 PRINT " COIL DESIGNER";TAB(57);"by George Murphy VE3ERP ";
- 270 COLOR 1,0:PRINT STRING$(80,223);
- 280 COLOR 7,0
- 290 GOSUB 2960 'preface - page 1
- 300 COLOR 0,7:LOCATE 25,22
- 310 PRINT " Press 1 to continue or 0 to EXIT.....";
- 320 COLOR 7,0
- 330 Z$=INKEY$:IF Z$=""THEN 330
- 340 IF Z$="0"THEN CLS:CHAIN GO$
- 350 IF Z$="1"THEN 370
- 360 GOTO 330
- 370 GOSUB 3640 'screen dump
- 380 LN=3:GOSUB 740 'clear screen
- 390 '
- 400 PRINT " Press number in < > to choose standard units of measure:"
- 410 PRINT UL$;
- 420 PRINT " < 1 > Metric"
- 430 PRINT " < 2 > U.S.A./Imperial"
- 440 Z$=INKEY$
- 450 IF Z$="1"THEN UM=25.4:UM$=" mm":GOTO 480
- 460 IF Z$="2"THEN UM=1:UM$=" in.":GOTO 480
- 470 GOTO 440
- 480 LN=3:GOSUB 740 'clear screen
- 490 GOSUB 3370 'preface - page 2
- 500 PRINT UL$;
- 510 '
- 520 PRINT " Press letter in < > to select desired ";
- 530 PRINT "optimum Length-to-Diameter Ratio:"
- 540 PRINT UL$;
- 550 PRINT " < a > 0.5:1"
- 560 PRINT " < b > 1.0:1"
- 570 COLOR 15,2
- 580 PRINT " < c > 1.5:1 COLOR recommended for most "
- 590 PRINT " < d > 2.0:1 ' amateur radio applications "
- 600 COLOR 7,0
- 610 PRINT " < e > 2.5:1"
- 620 PRINT " < f > 3.0:1"
- 630 PRINT " < g > 4.0:1";
- 640 Z$=INKEY$
- 650 IF Z$="a"THEN LD=0.5:GOTO 780
- 660 IF Z$="b"THEN LD=1:GOTO 780
- 670 IF Z$="c"THEN LD=1.5:GOTO 780
- 680 IF Z$="d"THEN LD=2:GOTO 780
- 690 IF Z$="e"THEN LD=2.5:GOTO 780
- 700 IF Z$="f"THEN LD=3:GOTO 780
- 710 IF Z$="g"THEN LD=4:GOTO 780
- 720 GOTO 640
- 730 '
- 740 '.....erase screen to bottom
- 750 VIEW PRINT LN TO 24:CLS:VIEW PRINT:LOCATE LN
- 760 RETURN
- 770 '
- 780 '.....start
- 790 CLS
- 800 '.....input inductance
- 810 COLOR 0,7:PRINT " DESIGN SPECIFICATIONS for a";
- 820 PRINT STR$(LD);":1 length-to-diameter ratio coil:"
- 830 COLOR 7,0
- 840 IF UH THEN 880
- 850 INPUT " ENTER: Inductance (>H)......................";UH
- 860 LN=CSRLIN-1:GOSUB 740
- 870 IF UH=0 THEN BEEP:GOTO 850
- 880 PRINT " Inductance...........................";USING U1$;UH;
- 890 PRINT " >H"
- 900 LN=CSRLIN
- 910 IF WHIP=0 THEN 980
- 920 PRINT UL$;
- 930 PRINT TAB(7);
- 940 PRINT "FOR MOBILE WHIP LOADING COILS USE THE LARGEST PRACTICABLE DIAMETER"
- 950 PRINT TAB(7);
- 960 PRINT "WIRE OR TUBING CONDUCTOR."
- 970 '
- 980 '.....input conductor size
- 990 IF W THEN AWG=W:DIA=GA(AWG):GOTO 1190
- 1000 IF DIA THEN 1190
- 1010 'LN=CSRLIN
- 1020 PRINT UL$;
- 1030 PRINT " Press letter in < > to describe coil conductor size:"
- 1040 PRINT UL$;
- 1050 PRINT " < a > Diameter in millimetres"
- 1060 PRINT " < b > Diameter in inches"
- 1070 PRINT " < c > AWG#"
- 1080 Z$=INKEY$
- 1090 IF Z$="a"OR Z$="A"THEN WS$="mm":GOTO 1130
- 1100 IF Z$="b"OR Z$="B"THEN WS$="inches":GOTO 1130
- 1110 IF Z$="c"OR Z$="C"THEN WS$="AWG#":GOTO 1130
- 1120 GOTO 1080
- 1130 PRINT " ENTER: Conductor diameter (";WS$;")";:INPUT Z
- 1140 IF WS$="mm"THEN DIA=Z/25.4
- 1150 IF WS$="inches"THEN DIA=Z
- 1160 IF WS$="AWG#"THEN AWG=Z:DIA=GA(Z)
- 1170 GOSUB 740
- 1180 '
- 1190 PRINT " Conductor diameter...................";USING U1$;DIA*UM;
- 1200 PRINT UM$;", "
- 1210 LN=CSRLIN
- 1220 PRINT UL$;
- 1230 PRINT " Press number in <> to select conductor type:"
- 1240 PRINT UL$;
- 1250 PRINT " < 1 > Bare"
- 1260 PRINT " < 2 > Enamelled"
- 1270 PRINT " < 3 > Insulated"
- 1280 W$=INKEY$
- 1290 IF W$="1" THEN WIR$="bare":SP=2*DIA:GOTO 1340
- 1300 IF W$="2" THEN WIR$="enamelled":SP=DIA+0.005:GOTO 1340
- 1310 IF W$="3" THEN WIR$="insulated":GOTO 1340
- 1320 GOTO 1280
- 1330 '
- 1340 '.....turns per inch
- 1350 LOCATE 3,60:PRINT WIR$;
- 1360 IF AWG THEN PRINT " (AWG#";USING "###";AWG;:PRINT ")" ELSE PRINT ""
- 1370 IF W$="1"OR W$="2"THEN 1480
- 1380 GOSUB 740
- 1390 PRINT UL$;
- 1400 TB=9
- 1410 PRINT TAB(TB);
- 1420 PRINT "Wrap some of the #";AWG;WIR$;" wire around a ruler to determine"
- 1430 PRINT TAB(TB);
- 1440 PRINT "the maximum number of turns that can be wound in 25mm (1 inch)."
- 1450 PRINT UL$;
- 1460 INPUT " ENTER: How many turns can be wound in 25mm (1 inch)";TPI
- 1470 SP=1/TPI
- 1480 GOSUB 740
- 1490 PRINT " Approximate spacing of coil turns....";USING U1$;SP*UM;
- 1500 PRINT UM$
- 1510 '
- 1520 '.....calculate coil length and form diameter by iteration
- 1530 CD=0.25 'default coil diameter
- 1540 PRINT "........Iterating........please wait........."
- 1550 L=LD*CD 'length=L/D ratio x diameter
- 1560 N=(SQR(UH*(18*CD+40*L)))/CD 'number of turns
- 1570 IF (N*SP)>L THEN CD=CD+0.000999999:GOTO 1550
- 1580 '
- 1590 T=1/SP 'turns per inch
- 1600 IF W$="1" THEN X=DIA 'X=O.D.of wire c/w insulation, if any
- 1610 IF W$="2"OR W$="3"THEN X=SP
- 1620 CF=CD-X 'coil form diameter
- 1630 '
- 1640 LN=CSRLIN-1:GOSUB 740
- 1650 PRINT " Coil diameter........................";USING U1$;(CF+X)*UM;
- 1660 PRINT UM$
- 1670 PRINT " Outside diameter of coil form.....";
- 1680 COLOR 14,4:PRINT " D=";:COLOR 7,0:PRINT USING U1$;CF*UM;
- 1690 PRINT UM$
- 1700 COLOR 14,4:LOCATE CSRLIN-1,58:PRINT " * ";:COLOR 7,0
- 1710 PRINT " Number of turns......................";USING U1$;N;
- 1720 PRINT " Length of coil.......................";USING U1$;L*UM;
- 1730 PRINT UM$
- 1740 PRINT " Number of turns per 25 mm (inch).....";USING U2$;T
- 1750 PRINT " Length-to-Diameter ratio.............";USING U1$;L/CD;
- 1760 PRINT ":1"
- 1770 LOCATE CSRLIN,9
- 1780 COLOR 14,4:PRINT " * ";
- 1790 COLOR 0,7
- 1800 PRINT " Coil form diameter can be any size near";
- 1810 COLOR 14,4:PRINT " D ";
- 1820 COLOR 0,7:PRINT " ":COLOR 7,0
- 1830 PRINT UL$;
- 1840 LOCATE CSRLIN-1,18
- 1850 PRINT " SOME SUGGESTED SOURCES OF COIL FORM MATERIAL "
- 1860 PRINT " PVC pipe outside diameters:";
- 1870 PRINT TAB(39)"Shotgun shell diameters:"
- 1880 LN=CSRLIN
- 1890 DATA 3/8,1/2,3/4," 1 "," 1DEFSTR"," 1RENUM"," 2 "," 2RENUM"," 3 "," 3RENUM"," 4 "
- 1900 DATA .675, .84, 1.05, 1.315, 1.66, 1.9, 2.375, 2.875, 3.5, 4, 4.5
- 1910 FOR Y=1 TO 11:READ P$(Y,1):NEXT Y
- 1920 FOR Y=1 TO 11:READ P$(Y,2):NEXT Y
- 1930 FOR Y=1 TO 11
- 1940 PRINT " nom. ";P$(Y,1);" =";USING "##.###";VAL(P$(Y,2));
- 1950 PRINT " in. (";USING "###.#";VAL(P$(Y,2))*25.4;:PRINT " mm)";
- 1960 IF Y<11 THEN PRINT ""
- 1970 NEXT Y
- 1980 LOCATE LN
- 1990 '
- 2000 DATA ".410 ", .41, 28-Ga., .55, 20-Ga., .615, 16-Ga., .662
- 2010 DATA 12-Ga., .729, 10-Ga., .775,"","","","","",""
- 2020 FOR Y=1 TO 6:READ G$(Y,1),G$(Y,2)
- 2030 LOCATE ,42:PRINT G$(Y,1);USING "#####.###";VAL(G$(Y,2));
- 2040 PRINT " in. (";USING "###.#";VAL(G$(Y,2))*25.4;:PRINT " mm)"
- 2050 NEXT Y
- 2060 RESTORE
- 2070 LOCATE 21,42
- 2080 COLOR 14,4:PRINT " * ";
- 2090 COLOR 0,7
- 2100 PRINT " ENTER: Your choice of outside "
- 2110 LOCATE 22,42
- 2120 PRINT " diameter of coil form (";UM$;")...";
- 2130 INPUT CF
- 2140 CF=CF/UM
- 2150 COLOR 7,0
- 2160 LOCATE 6,43:PRINT "..." 'delete D=
- 2170 LOCATE 6,58:PRINT " " 'delete asterisk
- 2180 LN=11
- 2190 GOSUB 740
- 2200 PRINT
- 2210 '
- 2220 '.....re-calculate
- 2230 CD=CF+X 'coil diameter
- 2240 R=CD/2 'coil radius
- 2250 Q=R^2*T^2/UH 'factor
- 2260 L=ABS(-10-SQR(100+36*R*Q))/2/Q 'length of winding
- 2270 N=(SQR(UH*(18*CD+40*L)))/CD 'number of turns
- 2280 T=N/L 'turns per inch
- 2290 COLOR 0,7
- 2300 PRINT " ALTERNATE DESIGN FOR A ^";STR$(CF*UM);UM$;" COIL FORM:"
- 2310 COLOR 7,0
- 2320 GOSUB 2350
- 2330 GOTO 2550
- 2340 '
- 2350 '.....screen print
- 2360 PRINT " Inductance...........................";USING U1$;UH;
- 2370 PRINT " >H"
- 2380 PRINT " Conductor diameter...................";USING U1$;DIA*UM;
- 2390 PRINT UM$;", ";WIR$;
- 2400 IF AWG THEN PRINT " (AWG#";USING "###";AWG;:PRINT ")" ELSE PRINT ""
- 2410 PRINT " Approximate spacing of coil turns....";USING U1$;SP*UM;
- 2420 PRINT UM$
- 2430 PRINT " Coil diameter........................";USING U1$;(CF+X)*UM;
- 2440 PRINT UM$
- 2450 PRINT " Outside diameter of coil form........";USING U1$;CF*UM;
- 2460 PRINT UM$
- 2470 PRINT " Number of turns......................";USING U1$;N;
- 2480 PRINT " Length of coil.......................";USING U1$;L*UM;
- 2490 PRINT UM$
- 2500 PRINT " Number of turns per 25 mm (inch).....";USING U2$;T
- 2510 PRINT " Length-to-Diameter ratio.............";USING U1$;L/CD;
- 2520 PRINT ":1"
- 2530 RETURN
- 2540 '
- 2550 IF N=INT(N)THEN Z$="n":GOTO 2600
- 2560 COLOR 0,7
- 2570 PRINT " Do you want to adjust the number of turns? (y/n)";
- 2580 COLOR 7,0
- 2590 Z$=INKEY$
- 2600 IF Z$="n"THEN LN=CSRLIN:GOSUB 740:GOTO 2790
- 2610 IF Z$="y"THEN 2640
- 2620 GOTO 2590
- 2630 '
- 2640 '.....recalculate length
- 2650 LNX=LN:LN=CSRLIN:GOSUB 740
- 2660 COLOR 0,7
- 2670 INPUT " ENTER: How many turns ";N
- 2680 COLOR 7,0
- 2690 L=((CD^2*N^2/UH)-(18*CD))/40
- 2700 SP=L/N
- 2710 T=N/L
- 2720 LN=LNX:GOSUB 740:LOCATE LNX+1
- 2730 COLOR 0,7
- 2740 PRINT " ALTERNATE DESIGN FOR";N;
- 2750 PRINT "TURNS ON A ^";STR$(CF*UM);UM$;" COIL FORM:"
- 2760 COLOR 7,0
- 2770 GOSUB 2350
- 2780 '
- 2790 '.....end
- 2800 LW=(CD*PI*N) 'length in inches
- 2810 IF UM=25.4 THEN UM=0.0254:UM$=" m."
- 2820 PRINT " Approx.length of conductor required..";USING U1$;LW*UM;
- 2830 PRINT UM$
- 2840 PRINT
- 2850 COLOR 0,7:PRINT " Do you want to try another coil of the same ";
- 2860 PRINT "inductance? (y/n) ";:COLOR 7,0
- 2870 Z$=INKEY$: IF Z$=""THEN 2870
- 2880 IF Z$="y"THEN CLS:GOTO 490
- 2890 IF Z$="n"THEN LOCATE CSRLIN-1:PRINT STRING$(79,32);:GOTO 2910
- 2900 GOTO 2870
- 2910 GOSUB 3640
- 2920 UH=0:DIA=0
- 2930 IF EX$<>GO$ THEN CHAIN GO$
- 2940 GOTO 230 'start
- 2950 '
- 2960 '.....preface - page 1
- 2970 TB=7
- 2980 PRINT TAB(TB);
- 2990 PRINT "This program designs single-layer air-core coils using formulae"
- 3000 PRINT TAB(TB);
- 3010 PRINT "published in the 1996 ARRL HANDBOOK, page 6.22. These formulae"
- 3020 PRINT TAB(TB);
- 3030 PRINT "provide close approximations of values for frequencies in the 1-30"
- 3040 PRINT TAB(TB);
- 3050 PRINT "MHz range that are sufficiently accurate for most Amateur Radio"
- 3060 PRINT TAB(TB);
- 3070 PRINT "purposes. The calculations are useful in the VHF and UHF range but"
- 3080 PRINT TAB(TB);
- 3090 PRINT "only as a basis for further calculation and experimentation."
- 3100 PRINT
- 3110 PRINT TAB(TB);
- 3120 PRINT "The program designs CLOSE-WOUND coils. Turn spacing is calculated"
- 3130 PRINT TAB(TB);
- 3140 PRINT "as follows:"
- 3150 PRINT
- 3160 PRINT TAB(TB);
- 3170 PRINT " - BARE CONDUCTOR (wire or tubing) @ twice its diameter."
- 3180 PRINT TAB(TB);
- 3190 PRINT " (you can use scraps of the same size conductor as turn spacers)."
- 3200 PRINT
- 3210 PRINT TAB(TB);
- 3220 PRINT " - ENAMELLED WIRE @ wire diameter + .005";CHR$(34);". ( .127 mm )"
- 3230 PRINT
- 3240 PRINT TAB(TB);
- 3250 PRINT " - INSULATED WIRE @ outside diameter of the insulation."
- 3260 PRINT
- 3270 PRINT TAB(TB);
- 3280 PRINT "The accuracy of the formulae used in this program may decrease if"
- 3290 PRINT TAB(TB);
- 3300 PRINT "the recommended turn spacing is greatly increased. In every case"
- 3310 PRINT TAB(TB);
- 3320 PRINT "spread the windings evenly over the winding length and secure in"
- 3330 PRINT TAB(TB);
- 3340 PRINT "place with shellac or other suitable coating."
- 3350 RETURN
- 3360 '
- 3370 'preface - page 2
- 3380 PRINT TAB(TB);
- 3390 PRINT "The ratio of coil length to coil diameter can affect the Q of a"
- 3400 PRINT TAB(TB);
- 3410 PRINT "single-layer close-wound coil. A high Q ensures improved circuit"
- 3420 PRINT TAB(TB);
- 3430 PRINT "efficiency, a narrower bandwidth and less wide-band noise in"
- 3440 PRINT TAB(TB);
- 3450 PRINT "oscillator circuits. In designing a high Q coil the following"
- 3460 PRINT TAB(TB);
- 3470 PRINT "parameters should be considered:"
- 3480 PRINT
- 3490 PRINT TAB(TB);
- 3500 PRINT "- The conductor diameter should be as large as practicable."
- 3510 IF WHIP=1 THEN 3540
- 3520 PRINT TAB(TB);
- 3530 PRINT "- The turn spacing should be as close as practicable."
- 3540 PRINT TAB(TB);
- 3550 PRINT "- The coil form should have a low dielectric constant. Air is best."
- 3560 PRINT TAB(TB);
- 3570 PRINT "- The Length-to-Diameter Ratio should not exceed 4:1. Ratios of"
- 3580 PRINT TAB(TB);
- 3590 PRINT " between 1:1 and 2:1 are preferred for most circuits. In no case"
- 3600 PRINT TAB(TB);
- 3610 PRINT " should the ratio be less than 0.4:1."
- 3620 RETURN
- 3630 '
- 3640 'HARDCOPY
- 3650 GOSUB 3760:LOCATE 25,2:COLOR 14,6
- 3660 PRINT " Press 1 to print screen, 2 to print screen & ";
- 3670 PRINT "advance paper, or 3 to continue.";:COLOR 7,0
- 3680 Z$=INKEY$:IF Z$="3"THEN GOSUB 3760:RETURN
- 3690 IF Z$="1"OR Z$="2"THEN GOSUB 3760:GOTO 3710
- 3700 GOTO 3680
- 3710 FOR QX=1 TO 24:FOR QY=1 TO 80
- 3720 LPRINT CHR$(SCREEN(QX,QY));
- 3730 NEXT QY:NEXT QX
- 3740 IF Z$="2"THEN LPRINT CHR$(12)
- 3750 GOTO 3650
- 3760 LOCATE 25,1:PRINT STRING$(80,32);:RETURN
-